//package hpc_homework1b;

import java.util.*;

/**
 *
 * @author deus
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        final int size = Integer.parseInt(args[0]);

        //int size = 9000000;
        long start, end, elapsed;
        
        int[] arr = new int[size];

        Random generator = new Random();

        for(int counter = 0;counter<size; counter++){
            arr[counter] = generator.nextInt();
        }

        start = System.currentTimeMillis();
        Arrays.sort(arr);
        end = System.currentTimeMillis();
        elapsed = end - start;

        System.out.println(size + " " + elapsed);


    }

}
